package org.contacts.action.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.contacts.dao.Contact;

public class LoginServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException{
    	
    	List<Contact> contacts = new ArrayList<Contact>();
    	contacts.add(new Contact(1, "Sherzod", "Muratov", "999000999"));
    	contacts.add(new Contact(2, "Tim", "Cook", "54634534534"));
    	
    	request.setAttribute("contacts", contacts);
    	RequestDispatcher dispatcher = request.getRequestDispatcher("list.jsp");
    	dispatcher.forward(request, response);   	
    }
}
